package com.newy.core.springmvc;

import java.beans.PropertyEditorSupport;
import java.util.Date;

import com.newy.core.util.LangUtils;


/**
 * 日期属性编辑器，主要用于spring mvc处理日期类型的请求参数
 * @author linzongxue 2011-07-05
 *
 */
public class DateEditor extends PropertyEditorSupport {
	public static DateEditor instance = new DateEditor();
	
	private DateEditor(){}
	
	public void setAsText(String value){
		setValue(LangUtils.parseDate(value));
	}
	
	public String getAsText(){
		return LangUtils.formatDate((Date)getValue());
	}
}
